home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98a.txt
/
000069_icon-group-sender _Fri Feb 27 08:17:05 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
8KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id IAA11456
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Fri, 27 Feb 1998 08:17:05 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA32434; Fri, 27 Feb 1998 08:17:04 -0700
From: gep2@computek.net
Date: Fri, 27 Feb 1998 01:10:16 -0600
Message-Id: <199802270710.BAA08211@axp.cmpu.net>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Subject: Re: Translation into C
To: icon-group@optima.CS.Arizona.EDU
X-Mailer: SPRY Mail Version: 04.00.06.17
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 7532
>>> Mark Evans suggested that the reason one might want an Icon to C
> translator is that the resulting program will execute faster because it
> doesn't need to be interpreted. But I wonder how much difference that
> would really make. If the C program spends most of its time calling
> library routines, then I wouldn't expect much difference at all.
>> Right.
> I don't follow the logic here. Even compiled C programs spend most of
their time inside libraries (system, numerical, string, file).
Yes, but C programs tend to spend a lot of time in directly executed mainline
code... address computation, integer arithmetic, pointer dereferencing, much
character handling, most testing and branching, case statements, if/then, most
tests and conditionals, etc. etc. It's relatively rare for C programs that
don't EXPLICITLY call functions to use runtime library calls. Compare this
against a much higher-level language like Icon or S*BOL, where virtually every
statement probably involves NUMEROUS runtime library routine calls.
> I have some anecdotal statistics of my own. I have used several
interpreted languages related to numerical analysis; let's take four of
them, Mathematica, MATLAB, O-Matrix, and LabVIEW. In principle, all of
them are interpreted except LabVIEW, which claims to be "compiled."
> I've used Mathematica more than any of them and it is closest in nature
to Icon. It is very high-level. The usual case is that I prototype an
algorithm in MMA and then port it to C. The resulting speedup is
usually larger than 10x, sometimes 20x to 50x. The example I am
thinking of is 2D image convolution. I know how to code well in MMA so
I know it's not my skill involved here. MMA has dynamic typing and
other goodies similar to Icon. In fact the two are fairly close in many
respects. It's very easy to create data structures in either language.
I think you're comparing apples and oranges. I suspect that if you tried to do
everything that MMA does (including dynamic typing etc) in your C port, it would
perform a lot closer to the Mathematica one. You're comparing a highly general,
higher-level tool against a much more tailored, more machine-specific C
implementation... I'd *expect* the C one to be a lot faster.
I don't think it's as much due to the "compiled/interpreted" issue as you seem
to think it is.
> MATLAB - One of my clients recently asked a local robotics research
outfit (ARRI) to build a simulation of their hydraulic system. They
used MATLAB and then switched to C for speed. They switched on their
own initiative because MATLAB was too slow. The speedup was on the
order of 40x (forty minutes down to one). This was for a time-domain
simulation of a relatively simple hydraulic strut invovling pressure,
temperature, and bulk modulus changes to figure out the spring and
damping forces. Several nonlinear dynamical equations involved.
Same point as above.
> O-Matrix - an unusual case (http://www.omatrix.com). This is
essentially a MATLAB clone. What make it interesting is that the
company claims a 5x speed improvement over MATLAB, not by eliminating
interpretation, but BY WRITING THE LIBRARY ROUTINES EFFICIENTLY. I
inquired specifically about this some while ago and the answer came back
that it was basically their hand-tuned assembly-language libraries that
gave them the edge over MATLAB's plain Jane C libraries. So yes,
library implementation can make a huge difference.
Obviously. Did YOUR tests confirm the 5x improvement?
> LabVIEW - Very interesting indeed. The vendor uses a kind of
compilation in LabVIEW of a nature that they say is "as fast as C." It
may be so for some simple Whetstone types of benchmarks, but in general
I have done algorithms both ways, and LabVIEW's speed doesn't hold a
candle to C. I would estimate the slowdown again at 10x-20x or
thereabouts. I have used LabVIEW extensively and know how to code it
well.
Same point as (way) above.
When I first started programming, my first language was PL/1, and I got to be
pretty good at it. Among other things, I studied the generated pseudo-assembler
code listings, and it really wasn't that bad (and in fact, under the Optimizing
Compiler, it got to be really quite good). The problem was in the runtime
libraries, which obviously had been programmed by programmers who were a *great*
deal less skilled (and/or motivated) to do a good job than the people were who
implemented the compiler itself. As long as you could keep the compiled code
out of the libraries, it _flew_. Code which included a lot of library routine
calls was virtually guaranteed to be slow.
I'm not suggesting that Icon's libraries and runtime are badly written... but
merely that a language like Icon which spends the great majority of its time in
runtime library ANYHOW simply probably won't gain nearly so much performance
improvement as a result of having the mainline compiled instead of
interpreted... and in fact, I think I remember reading in the Icon Newsletter
(years ago now) that one of the reasons they dropped support for the Compiler
(once upon a time) was because it was a maintenance hassle, and benchmarks
showed that the performance improvement for typical Icon programs was pretty
small in any case.
> All of the above indicate to me that no interpreted system in existence
has yet come close to C even though they claim to have done so.
That shouldn't really surprise anybody, since C is a hugely low-level language
(almost assembler language) with structures which largely map one-to-one with
machine instructions. C is also typically used for fairly compute-intensive
stuff that is programmed at a very low level, where the mainline execution speed
is very important. C also has little or no protection against things that most
higher level languages often try to protect you (and themselves, for that
matter) against... memory mismanagement, out-of-bounds array and string
accesses, etc etc ad infinitum. Higher level languages also often try to do a
lot more error control and reporting than C tends to do. All of that extra
stuff *does* take overhead, and usually the programmers of the higher level
languages simply accept this as part of the cost of their more powerful system.
Of course, there is some rationale for this argument, when even quite
substantial computers (166MHz Pentium class performance, complete with
multimedia, modem, and everying) sell *retail* for less than $500.
And for those people who TRULY have to struggle to optimize their programming to
the N-th degree, there are ultra-fast specialized processors (like the marvelous
TI DSP, a quite neat little CPU selling for less than $100 in production
quantities and which executes up to 1.6 - 2.0 billion instructions per second).
A coprocessor board based on this little gem (or maybe several of them),
plugging in to a PC, could outperform even fairly recent supercomputers on
really heavily compute-intensive tasks.
I think the reason why we've not seen more such things on the market is because
it's relatively rare that very many people TRULY NEED this level of performance.
Anyhow, processing power and disk space HAVE gotten cheap enough that it can be
wasted by the fistful, (regardless of how that dismays many of us); programmer
time is very often a far more critical issue than runtime performance.
Gordon Peterson
http://www.computek.net/public/gep2/
Support the Anti-SPAM Amendment! Join at http://www.cauce.org/